package com.ipzoe.common.core.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.ipzoe.common.core.domain.entity.SysDept;
import com.ipzoe.common.core.domain.entity.SysMenu;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Treeselect树结构实体类
 * 
 * @author ruoyi
 */
public class TreeSelectAdmin extends TreeSelect
{
    public static TreeSelect generateTreeSelect(SysDept dept)
    {
        TreeSelect treeSelect  = new TreeSelect();
        treeSelect.setId(dept.getDeptId());
        treeSelect.setLabel(dept.getDeptName());
        treeSelect.setChildren(dept.getChildren().stream().map(TreeSelectAdmin::generateTreeSelect).collect(Collectors.toList()));
        return treeSelect;
    }

    public static TreeSelect generateTreeSelect(SysMenu menu)
    {
        TreeSelect treeSelect  = new TreeSelect();
        treeSelect.setId(menu.getMenuId());
        treeSelect.setLabel(menu.getMenuName());
        treeSelect.setChildren(menu.getChildren().stream().map(TreeSelectAdmin::generateTreeSelect).collect(Collectors.toList()));
        return treeSelect;
    }
}
